MapArr

General Action Statement

Syntax samples

MAPARR <array name>{TO <variable name>}

MAPARR Array1 TO Var10

MAPARR Array5

Description

Starting with the variable you specify, the MAPARR statement maps each individual cell of an array to a unique variable (i.e., if you define 12 cells for the array, the array will map to 12 variables). To display the cell value of a mapped array, create a variable graphic for the variable to which you mapped the array cell. ProModel collects statistics for an array cell through the variable to which you mapped the cell. (Choose "Basic" or "Time Series" statistics for a mapped variable, then view the variable in the Statistics Output program.)

The initial value of the array cells are not written to the variables. Only changes to the array are recorded.

If you do not specify the optional variable name in the statement, ProModel will unmap the array from the variables to which you originally mapped it. You can remap arrays by using the MAPARR statement again.

Valid In

Any logic.

Components

<array name>

Map, unmap, or remap this array. The brackets, [ ], are unnecessary after the array name in the statement.

TO <variable name>

The optional name of the variable to which you map the first cell in the array. If you do not specify a name, ProModel will unmap the array from the variables.

Example

Suppose you want to dynamically view an array, Storage_Array, during simulation. The array has a dimension of 2x3x2 (a three-dimensional array with 2 cells in the first dimension, 3 cells in the second, and 2 cells in the third) and contains a total of 12 cells (multiply all the dimensions together).

Since you already used the first 8 of the 30 variables defined in the model, Var1 through Var30, you will start mapping the array with Var9 and end with Var20 (the 12th variable from Var9 listed in the Variables module). In the initialization logic, use the following statement:

MAPARR Storage_Array TO Var9

The cells in Storage_Array will map to variables Var9 to Var20 in the following order:

[1,1,1] ... Var9
[1,1,2] ... Var10
[1,2,1] ... Var11
[1,2,2] ... Var12
[1,3,1] ... Var13
[1,3,2] ... Var14
[2,1,1] ... Var15
[2,1,2] ... Var16
[2,2,1] ... Var17
[2,2,2] ... Var18
[2,3,1] ... Var19
[2,3,2] ... Var20

In the Variables module, create graphics for variables Var9 through Var20 and place them on the layout. This will allow you to view them during the simulation.

Please note

Changing the cell value of a mapped array will change the value stored in the array cell AND the value of the variable to which you mapped the specific cell. Changing the value of a variable (e.g., INC Var12), however, will change ONLY the variable value and NOT the cell value of the mapped array cell. Also, when you use a mapped array in an expression, the array returns the value of the variable mapped to it.